package com.itheima.controller;

import com.itheima.domain.db.Notification;
import com.itheima.service.db.NotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/notification")
public class NotificationController{

    @Autowired
    private NotificationService notificationService;

    @GetMapping("/findByUserId")
    public Notification findByUserId(Long userId) {
        return notificationService.findByUserId(userId);
    }

    @PostMapping("/save")
    public void save(@RequestBody Notification notification) {
        notificationService.save(notification);
    }

    @PutMapping("/update")
    public void update(@RequestBody Notification notification) {
        notificationService.update(notification);
    }
}